package exception;

public class TryCatchDemoZUOYE {
    public static void main(String[] args) {
        System.out.println("开始");
        try {
            String line=null;
            System.out.println(line.length());
            String line1="";
            System.out.println(line1.charAt(0));
            String line2="123";
            System.out.println(line2);
        } catch (NullPointerException|StringIndexOutOfBoundsException q){
            System.out.println("出现了空指针异常");
        } catch (Exception q){
            System.out.println("出现了空指针或字符串下标越界异常");
        }
        System.out.println("结束");
    }
}
